<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="java.util.*, common.selectMenu, book.*, common.*" %>
<%
	request.setCharacterEncoding("UTF-8");
	BookBean book = (BookBean)request.getAttribute("book");
	int holds = (Integer)request.getAttribute("holds");
	int rentals = (Integer)request.getAttribute("rentals");
	int reserves = (Integer)request.getAttribute("reserves");
	int books = (Integer)request.getAttribute("books");
	boolean canDelete =  (rentals < 1 && reserves < 1);
%>
<jsp:include page="/share/layout.jsp" flush="true">
    <jsp:param name="title" value="書籍情報削除確認"/>
    <jsp:param name="css" value="book.css"/>
    <jsp:param name="content">
        <jsp:attribute name="value">
<!-- contents start -->

<div id="bookEdit">
	<div class="book_img">
		<p><img src="http://192.168.3.190:8080/Books/book_img/<%= book.getPicture() %>.jpg" width="160px" height="160px" name="picture" /></p>
	</div>
<p  class="error_message">
	<% if (canDelete) { %>

	<% } else { %>
	貸出中、または、予約中のため削除できません
	<% } %>
</p>

<table class="form_table">
	<tr>
		<th>書籍ＩＤ</th>
		<td><%= book.getId() %></td>
	</tr>
	<tr>
		<th>タイトル</th>
		<td><%= book.getTitle() %></td>
	</tr>
	<tr>
		<th>著者名</th>
		<td><%= book.getWriter() %></td>
	</tr>
	<tr>
		<th>出版者</th>
		<td><%= book.getPublisher() %></td>
	</tr>
	<tr>
		<th>ジャンル</th>
		<td><%= book.getGenre() %></td>
	</tr>
	<tr>
		<th>ISBNコード</th>
		<td><%= book.getIsbn() %></td>
	</tr>
	<tr>
		<th>発行年月日</th>
		<td><%= book.getPublicationDate() %></td>
	</tr>
	<tr>
		<th>内容</th>
		<td><%= book.getContent() %></td>
	</tr>
</table>
</div>
<table class="form_table clear">
<caption>貸出情報</caption>
	<tr>
		<th>所蔵数</th>
		<th>貸出中冊数</th>
		<th>予約数</th>
		<th>貸出可能冊数</th>
	</tr>
	<tr>
		<td align="center"><%= holds %></td>
		<td align="center"><%= rentals %></td>
		<td align="center"><%= reserves %></td>
		<td align="center"><%= books %></td>
	</tr>
</table>

<p id="msg_area_c">
	<% if (canDelete) { %>
	以上の内容を削除しますか？
	<% } else { %>

	<% } %>
</p>

<div id="btn_area">
	<form action="/Books/book/SearchServlet" method="post">
			<input class="button" type="submit" value="戻る">
	</form>
	<form action="/Books/book/DeleteServlet" method="post">
			<input class="button" type="hidden" name="isbn" value="<%= book.getIsbn() %>" />
			<input class="button" type="submit" value="削除" <% if (!canDelete) { %>disabled="disabled"<% } %> />
	</form>
</div>


<!-- contents end -->
        </jsp:attribute>
    </jsp:param>
</jsp:include>

